<div class="table-body">
    <div class="layui-card-header">店铺资料</div>
    <div class="layui-card">
        <form class="layui-form layui-form-pane" lay-filter="myform">
            <div class="layui-form-item">
                <label class="layui-form-label">店铺名称</label>
                <div class="layui-input-inline from-inline-3">
                    <input type="text" name="row[name]" lay-verify="required" placeholder="请输入店铺名称" class="layui-input" value="{$shopinfo['name']}">
                </div>
                <div class="layui-form-mid layui-word-aux">不能输入“平台”、 “官方” 字符</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店铺分类</label>
                <div class="layui-input-inline from-inline-2">
                    <select name="row[sortid]" class="layui-select">
                        {volist name="sortlist" id="vo"}
                            <option value="{$vo.id}">{$vo.name}</option>
                        {/volist}
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店铺LOGO</label>
                <div class="layui-input-inline from-inline-2">
                    <input type="hidden" name="row[logo]" id="thumb" value="{$shopinfo['logo']}">
                    <div class="layui-upload">
                        <button type="button" class="layui-btn" id="onUpload">上传LOGO</button>
                        <div class="layui-upload-list">
                            <img class="layui-upload-img" width="86" height="86" src="{$shopinfo['logo']}" id="Image">
                            <p id="preview"></p>
                        </div>
                    </div>
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店铺介绍</label>
                <div class="layui-input-inline from-inline-5">
                    <textarea class="layui-textarea" id="content" lay-verify="required" placeholder="请输入店铺介绍" name="row[content]">{$shopinfo['content']}</textarea>
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店铺地址</label>
                <div class="layui-input-inline from-inline-4">
                    <input type="text" name="row[address]" lay-verify="required" placeholder="请输入店铺地址" class="layui-input" value="{$shopinfo['address']}">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="submit">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    //Demo
    layui.use(['form','upload'], function () {
        var form = layui.form,$= layui.jquery,upload = layui.upload;
        //图片上传
        var uploadInst = upload.render({
            elem: '#onUpload',
            url: '{:url("Images/uploadImage")}',
            done: function(res){
                if(res.status){
                    $('#thumb').val(res.data.url);
                    $('#Image').attr('src',res.data.url);
                }else{
                    //如果上传失败
                    return layer.msg('上传失败');
                }
            },
            error: function(){
                //演示失败状态，并实现重传
                var preview = $('#preview');
                preview.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini onReload">重试</a>');
                preview.find('.onReload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
        //监听提交
        form.on('submit(submit)', function (data) {
            console.log(data);
            $.post("", data.field, function (info) {
                if (info.code) {
                    layer.msg(info.msg);
                } else {
                    layer.msg(info.msg);
                }
            });
            return false;
        });
    });
</script>